﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity.ModelConfiguration;
using Yala.Models.Items;

namespace Yala.DataAccess.Common.EF.Mappings {
    public class ItemConfiguration : EntityTypeConfiguration<Item> {
        public ItemConfiguration() {
            ToTable("Items");
            HasKey(x => x.Id).Property(x => x.Id).HasColumnName("ItemId").IsRequired();
            Property(x => x.Name).HasColumnName("ItemName");
            Property(x => x.Description).HasColumnName("Description");
            Property(x => x.CreatedDate).HasColumnName("CreatedDate");
            HasRequired(x => x.Owner).WithMany(x => x.Items).Map(x => x.MapKey("OwnerId"));
        }
    }
}
